@use "@/styles/common.module.scss"as *;

@mixin btn_styling($bg_color_normal, $bg_color_hover, $bg_color_active, $border_color) {
  background-color  : $bg_color_normal;
  border-left-color : $border_color;
  border-top-color  : $border_color;
  border-right-color: $border_color;

  &:hover {
    background-color: $bg_color_hover;
  }

  &.tab_btn_active {
    background-color: $bg_color_active;
  }
}

.tab_btn {
  position               : relative;
  outline                : none;
  box-sizing             : border-box;
  height                 : 100%;
  display                : inline-block;
  padding                : 0px 10px;
  box-sizing             : border-box;
  align-self             : flex-start;
  position               : relative;
  font-size              : 12px;
  display                : flex;
  align-items            : center;
  z-index                : $z_idx_editor_view_tab_bar_btn;
  gap                    : 5px;
  border-radius          : 0px;
  border-top-left-radius : 10px;
  border-top-right-radius: 10px;
  border                 : 1px solid #88888833;
  transition             : background-color 200ms;
  word-break             : keep-all;
  white-space            : nowrap;

  &:hover {
    z-index: $z_idx_editor_view_tab_bar_btn_hover;
  }

  &.tab_btn_active {
    border-bottom-color: transparent;
    z-index            : $z_idx_editor_view_tab_bar_btn_hover;
  }

  &:not(:nth-child(2)) {
    margin-left: -1px;
  }

  &>.tab_btn_close {
    line-height     : 18px;
    width           : 18px;
    height          : 18px;
    text-align      : center;
    display         : flex;
    align-items     : center;
    justify-content : center;
    border-radius   : 4px;
    background-color: transparent;
    transition      : all 200ms;

    &:hover {
      background-color: #88888855;
    }

    &:active {
      background-color: #88888888;
    }
  }

  &.tab_btn_dragging {
    border-radius: 5px;
    border-bottom: 1px;
  }

  @include btn_styling(var(--view-bg-color-normal),
    var(--view-fg-color-normal),
    var(--view-fg-color-normal),
    var(--view-border-color-normal))
}